<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- Meta, title, CSS, favicons, etc. -->
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>随便打TCS系统</title>

<!-- Bootstrap -->
<link href="<%=basePath%>vendors/bootstrap/dist/css/bootstrap.min.css"
	rel="stylesheet">
<!-- Font Awesome -->
<link
	href="//netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
	rel="stylesheet">
<!-- NProgress -->
<link href="<%=basePath%>vendors/nprogress/nprogress.css"
	rel="stylesheet">
<!-- iCheck -->
<link href="<%=basePath%>vendors/iCheck/skins/flat/green.css"
	rel="stylesheet">

<!-- bootstrap-progressbar -->
<link
	href="<%=basePath%>vendors/bootstrap-progressbar/css/bootstrap-progressbar-3.3.4.min.css"
	rel="stylesheet">
<!-- JQVMap -->
<link href="<%=basePath%>vendors/jqvmap/dist/jqvmap.min.css"
	rel="stylesheet" />
<!-- bootstrap-daterangepicker -->
<link
	href="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.css"
	rel="stylesheet">

<!-- Custom Theme Style -->
<link href="<%=basePath%>build/css/custom.min.css" rel="stylesheet">

</head>
<body class="nav-md">
	<%@ include file="loginCheck.jsp"%>
	<div class="container body">
		<div class="main_container">
			<div class="col-md-3 left_col">
				<div class="left_col scroll-view">
					<div class="clearfix"></div>
					<br />
				</div>
			</div>
			<!-- page content -->
			<div class="right_col" role="main">
				<div class="">
					<div class="clearfix"></div>
					<div class="row">
						<div class="col-md-12 col-sm-12 col-xs-12">
							<div class="x_panel">
								<div class="x_content">
									<span class="section">活动配置</span>
									<form name="myForm" class="form-horizontal form-label-left"
										novalidate method="post" enctype="multipart/form-data"
										id="myForm">
										<div class="item form-group" style="display: none">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">id<span class="required"></span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="id" name="id"
													class="form-control col-md-7 col-xs-12" type="text"
													value="${users.id}">
											</div>
										</div>
										<div class="item form-group" <c:if test="${isLTH == 1}">style="display:none;"</c:if>>
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">注册赠送通话金额 <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="regimoney"
													class="form-control col-md-7 col-xs-12"
													data-validate-length-range="6" data-validate-words="2"
													name="regimoney" placeholder="例如：10" required="required"
													type="text" value="${users.regimoney}">
											</div>
										</div>
										<div class="item form-group" >
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">注册赠送购物金额 <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="regishopmoney"
													class="form-control col-md-7 col-xs-12"
													data-validate-length-range="6" data-validate-words="2"
													name="regishopmoney" placeholder="例如：10"
													required="required" type="text"
													value="${users.regishopmoney}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">注册赠送有效期 <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="regishopmoney"
													class="form-control col-md-7 col-xs-12"
													data-validate-length-range="6" data-validate-words="2"
													name="regitime" placeholder="例如：15(15等于15天)"
													required="required" type="text" value="${users.regitime}">
											</div>
										</div>
										<div class="item form-group" <c:if test="${isLTH == 1}">style="display:none;"</c:if>>
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">商圈动态扣除话费 <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="fare" class="form-control col-md-7 col-xs-12"
													data-validate-length-range="6" data-validate-words="2"
													name="fare" placeholder="例如：5.00" required="required"
													type="text" value="${users.fare}">
											</div>
										</div>
										<div class="form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12">签到任务页详细规则
												<span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<textarea name="rule" id="rule" class="form-control"><c:if
														test="${users.rule==null || users.rule==''}">&lt;p&gt;例如：今日任务请看具体描述&lt;/p&gt;</c:if>${users.rule}</textarea>
											</div>
											<span id="ruleprompt"
												style="font-size: 14px; color: #ff0033; display: none">
												自动清除所有空格，内容开始或分段请使用&lt;p&gt;内容&lt;/p&gt;，例如：&lt;p&gt;段落1&lt;/p&gt;&lt;p&gt;段落2&lt;/p&gt;</span>
										</div>
										<div class="item form-group" <c:if test="${isLTH == 1}">style="display:none;"</c:if>>
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">签到赠送通话金额 <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="weekcall" class="form-control col-md-7 col-xs-12"
													data-validate-length-range="6" data-validate-words="2"
													name="weekcall" placeholder="例如：5.00" required="required"
													type="text" value="${users.weekcall}">
											</div>
										</div>
										<div class="item form-group" <c:if test="${isLTH == 1}">style="display:none;"</c:if>>
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">连续签到赠送通话倍率 <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="weekmucall"
													class="form-control col-md-7 col-xs-12"
													data-validate-length-range="6" data-validate-words="2"
													name="weekmucall" placeholder="例如：1.50" required="required"
													type="text" value="${users.weekmucall}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">签到赠送购物金额 <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="weekshop" name="weekshop"
													class="form-control col-md-7 col-xs-12" type="text"
													placeholder="例如：5.00" value="${users.weekshop}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												for="name">连续签到赠送购物倍率 <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="weekmushop"
													class="form-control col-md-7 col-xs-12"
													data-validate-length-range="6" data-validate-words="2"
													name="weekmushop" placeholder="例如：1.50" required="required"
													type="text" value="${users.weekmushop}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												   for="name">抽奖模块一概率(谢谢参与) <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="dialfirst"
													   class="form-control col-md-7 col-xs-12"
													   data-validate-length-range="6" data-validate-words="2"
													   name="dialfirst" placeholder="例如：1.50" required="required"
													   type="text" value="${users.dialfirst}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												   for="name">抽奖模块二概率(谢谢参与) <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="dialsecond"
													   class="form-control col-md-7 col-xs-12"
													   data-validate-length-range="6" data-validate-words="2"
													   name="dialsecond" placeholder="例如：1.50" required="required"
													   type="text" value="${users.dialsecond}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												   for="name">抽奖模块三概率(15W保险) <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="dialthird"
													   class="form-control col-md-7 col-xs-12"
													   data-validate-length-range="6" data-validate-words="2"
													   name="dialthird" placeholder="例如：1.50" required="required"
													   type="text" value="${users.dialthird}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												   for="name">抽奖模块四概率(6元购物券) <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="dialfourth"
													   class="form-control col-md-7 col-xs-12"
													   data-validate-length-range="6" data-validate-words="2"
													   name="dialfourth" placeholder="例如：1.50" required="required"
													   type="text" value="${users.dialfourth}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												   for="name">抽奖模块五概率(18元购物券) <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="dialfifth"
													   class="form-control col-md-7 col-xs-12"
													   data-validate-length-range="6" data-validate-words="2"
													   name="dialfifth" placeholder="例如：1.50" required="required"
													   type="text" value="${users.dialfifth}">
											</div>
										</div>
										<div class="item form-group">
											<label class="control-label col-md-3 col-sm-3 col-xs-12"
												   for="name">抽奖模块六概率(15W保险) <span class="required">*</span>
											</label>
											<div class="col-md-6 col-sm-6 col-xs-12">
												<input id="dialsixth"
													   class="form-control col-md-7 col-xs-12"
													   data-validate-length-range="6" data-validate-words="2"
													   name="dialsixth" placeholder="例如：1.50" required="required"
													   type="text" value="${users.dialsixth}">
											</div>
										</div>
										<div class="form-group">
											<div class="col-md-6 col-md-offset-3">
												<input id="revise" type="button" class="btn btn-success"
													value="确定">
											</div>
										</div>
									</form>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
			<!-- /page content -->
		</div>
	</div>
	<!-- /page content -->
	<!-- 上传图片并修改 -->
	<script src="<%=basePath%>vendors/jquery/dist/jquery.min.js"></script>
	<script>
		$("#rule").mouseover(function() {
			$("#ruleprompt").css("display", "block");
		});
		$("#rule").mouseout(function() {
			$("#ruleprompt").css("display", "none");
		});
	</script>
	<script type="text/javascript">
		$('#revise').click(function() {
			var partten1 = /^[0-9]{1,10}$/;
			var partten2 = /^[0-9]{1,18}\.[0-9]{1,2}$/;
			var partten3 = /^[0-9]{1,10}.0{1,2}$/;
			if ((!partten1.test($("#fare").val()) && !partten2.test($("#fare").val())) ||
					(!partten1.test($("#weekcall").val()) && !partten2.test($("#weekcall").val())) ||
					(!partten1.test($("#weekshop").val()) && !partten3.test($("#weekshop").val())) ||
					(!partten1.test($("#weekmucall").val()) && !partten2.test($("#weekmucall").val())) ||
					(!partten1.test($("#weekmushop").val()) && !partten3.test($("#weekmushop").val())) ||
					(!partten1.test($("#regimoney").val())) ||
					(!partten1.test($("#regishopmoney").val()))) {
				alert('请输入正确的数字，注册赠送金额、签到赠送购物金额、购物倍率只可填写整数，其他例如：10.00（整数最长为18位，小数最长为2位）');
				return false;
			}
			$("#rule").val(Trim($("#rule").val(),"g"));
			$.ajax({
				type : 'POST',
				url : 'allocations_do_update',
				data : $('#myForm').serialize(),
				dataType : 'json',
				success : function(date) {
					switch (date) {
					case -1:
						alert("登录超时，请重新登录");
						top.location.href = "login/${titleId}";
						break;
					case 1:
						alert("修改成功");
						location.href = "activitys_index";
						break;
					default:
						alert("修改失败，请重新操作");
						break;
					}
				},
				error : function() {
					alert("修改失败，请重新操作");
			    }
			});					
		});
		// 清除空格
		function Trim(str,is_global){
			var result;
		   	result = str.replace(/(^\s+)|(\s+$)/g,"");
		   	if(is_global.toLowerCase()=="g"){
		    	result = result.replace(/\s/g,"");
		   	}
		   	return result;
		}
	</script>
	<!-- Bootstrap -->
	<script src="<%=basePath%>vendors/bootstrap/dist/js/bootstrap.min.js"></script>
	<!-- FastClick -->
	<script src="<%=basePath%>vendors/fastclick/lib/fastclick.js"></script>
	<!-- NProgress -->
	<script src="<%=basePath%>vendors/nprogress/nprogress.js"></script>
	<!-- bootstrap-daterangepicker -->
	<script src="<%=basePath%>vendors/moment/min/moment.min.js"></script>
	<script
		src="<%=basePath%>vendors/bootstrap-daterangepicker/daterangepicker.js"></script>
	<!-- Chart.js -->
	<script src="<%=basePath%>vendors/Chart.js/dist/Chart.min.js"></script>

	<!-- Custom Theme Scripts -->
	<script src="<%=basePath%>build/js/custom.min.js"></script>
</body>
</html>